$(document).on("click", "#admin", function () {
    window.location.href = "/page/admin";
});

$(document).on("click", "#watch-course", function () {
    window.location.href = "/page/watch-course";
});

$(document).on("click", "#notice-price-course", function () {
    window.location.href = "/page/notice-price-course";
});

$(function () {
    $('.weui-tab').tab({
        defaultIndex: 2,
        activeClass: 'weui-bar__item_on',
        onToggle: function (index) {
            if (index === 0) {
                location.href = "/page/product";
            } else if (index === 1) {
                location.href = "/page/watch";
            } else if (index === 2) {
            }
        }
    });

    $.ajax({
        type: "GET",
        url: "/user/check-admin",
        success: function (result) {
            if (result.code === "0") {
                document.getElementById("admin").style.display = "block";
            }
        }
    });
});